Skip to content

fix(system): correct service, update repair, and legacy imports - #4966

Merged
ChrisTitusTech merged 6 commits into
ChrisTitusTech:mainfrom
virtualtable:fix/system-helpers-and-impex
Aug 19, 2026
Merged

fix(system): correct service, update repair, and legacy imports#4966
ChrisTitusTech merged 6 commits into
ChrisTitusTech:mainfrom
virtualtable:fix/system-helpers-and-impex

Conversation

@virtualtable

@virtualtable virtualtable commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • pass the PowerShell 5 delayed-start arguments to sc.exe with the required spacing and report non-zero exit codes
  • remove the WSUS client registry values with PowerShell registry commands instead of malformed REG DELETE paths
  • import historical grouped WinUtil configurations while ignoring the legacy Install package metadata and retaining strict validation for selection keys
  • merge the current main branch and add regression coverage for the historical import shape

Validation

  • .\Compile.ps1
  • Pester 5.8.0 full suite: 562 passed, 0 failed
  • focused UI-state suite: 20 passed, 0 failed
  • PowerShell Script Analyzer completed with only existing accepted repository warnings
  • local Codex review loop completed; no actionable findings remain
  • legacy fixture confirmed apps, tweaks, toggles, and features import without treating package metadata as selections

Manual validation

The destructive service and Windows Update repair operations were not run against the host. Their behavior is covered by source review and focused helper tests.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 507008ca-1cb8-4a41-a2ca-b254672bc285

📥 Commits

Reviewing files that changed from the base of the PR and between eba5142 and cb44dbe.

📒 Files selected for processing (2)
  • functions/public/Invoke-WPFImpex.ps1
  • pester/ui-state.Tests.ps1

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Fixed delayed automatic service startup configuration.
    • Improved WSUS client cleanup by reliably removing stale identification values.
    • Improved configuration imports by supporting legacy formats and validating all selections before applying changes.
    • Prevented malformed imports from partially replacing existing selections.
  • Tests

    • Added coverage for importing legacy configurations with grouped selections, ensuring metadata is handled correctly without errors.

Walkthrough

The changes correct delayed service startup configuration, replace WSUS registry deletion processes with PowerShell commands, and improve legacy import handling with atomic selection replacement and regression coverage.

Changes

Windows utility maintenance

Layer / File(s) Summary
Service startup validation
functions/private/Set-WinUtilService.ps1
The delayed automatic startup command now passes start= delayed-auto and throws when sc.exe returns a nonzero exit code.
WSUS registry cleanup
functions/public/Invoke-WPFFixesUpdate.ps1
The AccountDomainSid, PingID, and SusClientId values are removed with Remove-ItemProperty while retaining silent error handling.
Legacy import validation
functions/public/Invoke-WPFImpex.ps1, pester/ui-state.Tests.ps1
Legacy configurations with Install metadata are flattened without importing the metadata. Imports validate selections before replacing existing state, with regression coverage for grouped legacy selections.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to cb44d

The PR updates service repair, Windows Update repair, and legacy import behavior with focused and full test validation reported as passing; no actionable merge-blocking risk remains.

Possibly related PRs

Suggested labels: bug

Suggested reviewers: christitustech

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the service, update repair, and legacy import fixes in the changeset.
Description check ✅ Passed The description directly explains the implemented fixes, compatibility changes, tests, and validation results.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@functions/private/Set-WinUtilService.ps1`:
- Line 36: Update the service configuration flow around sc.exe config in
Set-WinUtilService so it checks $LASTEXITCODE immediately after the command and
throws when the exit code is non-zero. Keep the success log only on the
successful path, allowing the existing catch handling to report configuration
failures.

In `@functions/public/Invoke-WPFImpex.ps1`:
- Around line 76-86: The legacy-import flattening logic around $flattenedJson
must exclude the metadata object represented by the Install property before
Update-WinUtilSelections is called, retaining only selection identifiers and
preserving flat-import behavior. Add a regression fixture that verifies legacy
and flat imports produce equivalent selections.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9b64fa5d-4c41-4263-b7f5-9ee0229a183c

📥 Commits

Reviewing files that changed from the base of the PR and between ea5de27 and 60a541d.

📒 Files selected for processing (4)
  • functions/private/Set-WinUtilDNS.ps1
  • functions/private/Set-WinUtilService.ps1
  • functions/public/Invoke-WPFFixesUpdate.ps1
  • functions/public/Invoke-WPFImpex.ps1

Comment thread functions/private/Set-WinUtilService.ps1
Comment thread functions/public/Invoke-WPFImpex.ps1

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60a541d1cf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread functions/public/Invoke-WPFImpex.ps1
@coderabbitai coderabbitai Bot added the bug Something isn't working label Aug 11, 2026
@virtualtable

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@virtualtable

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mewclouds

Copy link
Copy Markdown
Contributor

Thanks for working on this. I raised the same concern on #4911, but a decision has not been made in #4877 about what backward compatibility should mean here.

The backup format changed on February 17, almost six months ago. It is up to Chris to decide whether full compatibility is necessary or partial import is acceptable.

This skips the old Install section. That may be necessary because the old winget and choco metadata cannot be passed directly to the current selection importer, but it also means the backup is not necessarily fully restored. That needs an explicit product decision rather than being presented as complete backward compatibility.

I also cannot verify this was tested. There is no legacy JSON fixture, import-path test, or example of the old input and expected selections.

Finally, every provider in config/dns.json has Primary6 and Secondary6, so the IPv6 guard is always true. IPv4-only DNS providers are very rare.

@virtualtable

Copy link
Copy Markdown
Contributor Author

didnt know about #4877 and #4911, my bad. the legacy import thing was just to avoid the null key crash but yeah thats more of a product decision for chris on how far back compat should go. i can drop that + the ipv6 guard if youd prefer to keep this to just the sc.exe and reg fixes, lmk

@mewclouds

Copy link
Copy Markdown
Contributor

didnt know about #4877 and #4911, my bad. the legacy import thing was just to avoid the null key crash but yeah thats more of a product decision for chris on how far back compat should go. i can drop that + the ipv6 guard if youd prefer to keep this to just the sc.exe and reg fixes, lmk

I'd say keep the legacy import implementation for now and lets wait for Chris' input. The IPv6 guard can be removed. Good work on the bugfixes 😄

@virtualtable

Copy link
Copy Markdown
Contributor Author

sounds good, removed the ipv6 guard commit as suggested! leaving the rest for chris to review 👍

@ChrisTitusTech ChrisTitusTech changed the title fix(system): correct sc.exe argument syntax, reg deletion, and ipv6 dns guard fix(system): correct service, update repair, and legacy imports Aug 19, 2026

@ChrisTitusTech ChrisTitusTech left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the final branch after syncing with main. Local compile and all 562 Pester tests pass, all review threads are resolved, and both Codex and CodeRabbit review loops have no remaining actionable findings.

@ChrisTitusTech
ChrisTitusTech merged commit 4b2fe55 into ChrisTitusTech:main Aug 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants